 <template>
  <div class="intergration-wrapper">
    <centerHeader/>

    <div class="top-wrap">
      <p class="title-txt">
        <span class="title-01">我的积分:</span>
        <span class="title-02">{{user_info.user_score}}</span>
      </p>
    </div>

    <div class="centerCate-wrap">
      <ul>
        
        <li v-for="item in scoreorder_list" :key="item.score_order_id">
          <p>
            <!-- <router-link :to="{ name: 'order', params: {} }">
              
            </router-link> -->
              <span class="title-01">{{item.score_remark}}</span>
              <span class="title-02" :class="{'minus':item.score_type}">{{item.score_type == 0 ? '-' : ''}}{{item.score}}</span>
          </p>
        </li>
      </ul>

      <div class="submit-box">
        <button class="submit-btn" @click="scorelist">下拉加载更多</button>
      </div>
    </div>

    <centerFooter/>
  </div>
</template>
 
 <script type="text/ecmascript-6">
import centerHeader from "@/views/center/components/centerHeader";
import centerFooter from "@/views/center/components/centerFooter";
import constant from "@/utils/constant.js";
// 引用API文件
import http from "@/utils/http.js";

export default {
  name: "integration",
  data() {
    return {
      isBuy: true,
      user_info: {
        score: 0,
        quan_count: 0,
        collect_count: 0,
        zan_count: 0
      },
      scoreorder_list:[],
      constant: constant,
      p: 0
    };
  },
  components: {
    centerHeader,
    centerFooter
  },
  methods: {
    userinfo() {
      http.get(this, {
        url: "ucenter/user_info",
        data: {
          token: localStorage.getItem("user_token")
        },
        dataType: "json",
        success: function(data) {
          console.log("用户信息:", data);
          if (data.status == 1) {
            this.user_info = data.info;
          } else {
          }
        }
      });
    },
    scorelist(){
      this.p++;
      http.get(this, {
        url: "scoreorder/scoreorder_list",
        data: {
          token: localStorage.getItem("user_token"),
          pagesize: 3,
          p: this.p,
        },
        dataType: "json",
        success: function(data) {
          console.log("用户积分信息:", data);
          if (data.status == 1) {
            let info = data.info;
            if (this.p <= info.total_page) {
              this.scoreorder_list = this.scoreorder_list.concat(info.list);
            }
          } else {
          }
        }
      });
    }
  },
  created() {},
  activated() {
    this.p = 0;
    this.scoreorder_list = [];
	  this.userinfo();
	  this.scorelist();
  }
};
</script>
 
 <style scoped lang="scss">
.intergration-wrapper {
}

.top-wrap {
  $letHeight: 1.3rem;

  .title-txt {
    height: $letHeight;
    line-height: $letHeight;
    text-align: center;
    background-color: $c-white-light;

    span {
      color: $c-mainC;
      display: inline-block;
      line-height: $letHeight;
      vertical-align: middle;

      &.title-01 {
        font-size: 0.38rem;
      }
      &.title-02 {
        font-size: 0.48rem;
      }
    }
  }
}

.centerCate-wrap {
  width: 100%;
  text-align: center;

  ul {
    width: 100%;
    @extend .cmm-border;
    $letHeight: 0.75rem;

    li {
      border-top: 0.02rem solid $c-gray-dark;
      line-height: $letHeight;
      padding: 0 0.35rem;

      p {
        color: $c-mainC;
        @extend .cmm-clearfix;
        height: $letHeight;

        * {
          line-height: $letHeight;
          display: inline-block;
          vertical-align: middle;
        }

        a {
          width: 100%;
        }

        .title-01 {
          font-size: 0.32rem;
          float: left;
        }

        .title-02 {
          font-size: 0.32rem;
          float: right;
          color: $c-danger;

          &.minus {
            color: $c-success;
          }
        }
      }
    }
  }
}

.submit-box {
  padding: 0 0.66rem;
}
</style>
 